<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>new_sort</title>
<link rel="stylesheet" type="text/css" href="../resource/css/screen.css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/resource/js/jquery-1.4.2.js"></script>
<style type="text/css">
.lightbox{width:350px;background:#FFFFFF;border:1px solid #ccc;line-height:25px; top:20%; left:20%;}
.lightbox dt{background:#f4f4f4; padding:5px;font-size:12px;color:#666;}
.lightbox dd{
   padding-left:30px;
   text-align:center;
   }
.lightbox dd a{
	color:#0055C8;
	font-size:12px;
}
</style>
</head>

<body>
    <div class="wrap">
         <div class="header">
              <div class="logo">
                 <a href="#"><img alt="logo" src="../resource/images/brand.gif" /></a>
              </div>
             <div style="float:right;">
              <a href="/shuzi/sz/manager.action" style="background:url(../resource/images/control.gif) no-repeat left top; display:inline-block;height:56px;width:140px;"></a>
              </div>
         </div>

         <div class="content">
               <div class="new_sort">
                   <p>
                       <img alt="img" src="../resource/images/create_sort.gif" />
                   </p>
                   <p id="type">
                      <input type="text" class="text"/>
                      <a href="#"><img alt="create" src="../resource/images/create.gif" /></a>
                      <a href="#"><img alt="create" src="../resource/images/cancel.gif" /></a>
                   </p>
               </div>
         </div>
         
         <div class="pages">
         </div>

         <div class="footer">
           <span>&copy;</span><span>电子科技大学数字媒体技术研究所</span><span>All rights reserved</span>
           <span>&#124;</span><span>Powered by Dreamfly</span>
         </div>
    </div>
  <dl id="idBox" class="lightbox">
  <dt id="idBoxHead">温馨提示 </dt>
  <dd>
  <h4 id="sort_mess">添加分类已成功</h4>
  <p><a id="box_cont" href="#">继续添加</a> <a href="/shuzi/sz/manager.action">返回首页</a></p>
  </dd>
</dl>
<script type="text/javascript" src="${pageContext.request.contextPath}/resource/js/popup.js"></script>
<script type="text/javascript">
    $('p#type a')[0].onclick = function(event) {
    	var sort_name=$('p#type input').val().replace(/(^\s*)|(\s*$)/,"");
    	if(sort_name.length==0){
    		$("#sort_mess").text("不能为空值");
    		box.Show();
    		return false;
    	}
    	if(sort_name.length>=13){
    		$("#sort_mess").text("类名过长");
    		box.Show();
    		return false;
    	}
    	$.ajax({
    		type:"POST",
    		url:"${pageContext.request.contextPath}/sz/addPictureType.action",
    		data:{
    			"pictureType.name":$('p#type input').val()
    		},
    		dataType:"text",
    		success:function(data){
    			if(data=="success"){
    			$("#sort_mess").text("添加成功");
    				box.Show();
    			}else{
    				$("#sort_mess").text("添加失败");
    				box.Show();
    			}
    		},
    		error:function(){
    			$("#sort_mess").text("添加失败");
    				box.Show();;
    		}
    	});

    };
    $("#box_cont").click(function(){
    	box.Close();
    	$('p#type input').val("");
    });
</script>
</body>
</html>
